import SynchronizationLoginNork from '@/utils/SynchronizationLoginWork'
import Synchronization from "@/utils/Synchronization"

// 贴合材料列表
export interface ListOfFitMaterialsInterface{
    id: number,
    mtlNo: string,
    mtlColor: string,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    percent: string,
    purFlag: string,
    mtlSeq: number,
    prdType: string,
    vendor: string,
    change:string,
    disableConfirm:string
}

export const ListOfFitMaterials = () => {
    return Synchronization.get<any,ListOfFitMaterialsInterface[]>('/date/getCacheList')
}

// 贴合材料建档添加
export interface dataList{
    code:number,
    message:string,
    data:null
}

export interface ListOfFitAddListInterface{
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    mtlSpec:string,
    mtlUnit:string,
    vendor:string
}

export const ListOfFitAddList = (parms:ListOfFitAddListInterface) => {
    return SynchronizationLoginNork.post<any,dataList>('/date/getCacheAdd',parms)
}

// 正式材料和开发材料数据
export interface FormalMaterialsAndDevelopmentMaterialsInterface{
    mtlColor:string,
    mtlName:string,
    mtlNo:string,
    pageNum:number,
    pageNum2:number,
    pageSize:number,
    pageSize2:number,
    vendor:string
}

export interface FormalMaterialsAndDevelopmentMaterialsParms{
    officialMaterials: {
    adhesiveMaterialList: adhesiveMaterialList[],
    total?: number
    },
    developmentMaterials: {
    total?: number,
    developmentMaterialsList: adhesiveMaterialList[]
    }
}

export interface adhesiveMaterialList{
    mtlNo: string,
    mtlColor: string | null,
    mtlName: string,
    mtlSpec: null | string,
    mtlUnit: string,
    vendor: string
}


export const FormalMaterialsAndDevelopmentMaterials = (parms:FormalMaterialsAndDevelopmentMaterialsInterface) => {
    return  Synchronization.post<any,FormalMaterialsAndDevelopmentMaterialsParms>('/date/getAdhesiveMaterial',parms)
}

// 贴合材料建档删除
export const FitMaterialProfileDeleted = (parms:any) => {
    return SynchronizationLoginNork.post<any,dataList>('/date/getCacheDel',parms)
}

// 选择颜色
export interface chooseAColorInterface{
    total?: number,
    colorSystemList: colorSystemList[]
}

export interface colorSystemList{
    colorSystem: string,
    colorName:  string,
    pantone:  string,
    engColor: string
}

export interface chooseAColorParms{
    colorName:string,
    colorSystem:string,
    engColor:string,
    pageNum:number,
    pageSize:number,
    pantone:string
}

export const chooseAColor = (pamrs:chooseAColorParms) => {
    return Synchronization.post<any,chooseAColorInterface>('/ColorAttribute/getColorSystemList',pamrs)
}

// 厂商
export const ObtainVendor = () => {
    return SynchronizationLoginNork.get<any,any>('/back/vendorQuery')
}

// 上下移动接口
export const Fluctuation = (choose:number,id:number) => {
    return SynchronizationLoginNork.get<any,dataList>(`/date/getCacheMove/${choose}`,{
        params:{id:id}
    })
}

// 组成贴合材料
export interface TheCompositeMaterialIsFormedParms{
    id:number
    mtlNo:string
    mtlColor:string
    mtlName:string
    mtlSpec:string
    mtlUnit:string
    prdType:string
    vendor:string
    percent:string
    purFlag:string
}

export interface TheCompositeMaterialIsFormedInterface{
    code:number,
    message:string,
    data:interfaceTableDateList
}

export interface interfaceTableDateList{
    mtlColor:string
    mtlName:string
    mtlSpec:string
    mtlUnit:string
}

export const TheCompositeMaterialIsFormed = (parms:TheCompositeMaterialIsFormedParms[]) => {
    return SynchronizationLoginNork.post<any,TheCompositeMaterialIsFormedInterface>('/date/getCompositeMaterials',parms)
}

// 插入贴合材料
export interface InsertTheBondingMaterialParms{
    cacheVoRequests:any[]
    ids:number[],
    mtlColor?:string,
    mtlName?:string,
    mtlSpec?:string,
    mtlUnit?:string
}

export const InsertTheBondingMaterialList = (parms:InsertTheBondingMaterialParms) => {
    return SynchronizationLoginNork.post<any,dataList>('/date/getCompositeMaterialsAdd',parms)
}

// 插入贴合材料
export interface InsertTheBondingMaterialParms{
    cacheVoRequests:any[]
    ids:number[],
    mtlColor?:string,
    mtlName?:string,
    mtlSpec?:string,
    mtlUnit?:string
}

export const InsertTheBondingMaterialList1 = (parms:InsertTheBondingMaterialParms) => {
    return SynchronizationLoginNork.post<any,dataList>('/date/getCompositeMaterialsAdd2',parms)
}

// 色系
export const colourCcheme = () => {
    return Synchronization.get(`/boxList/vendorQuery`)
}

// 贴合材料建档保存
export const LaminatedMaterialFile = (parms:any) => {
    return SynchronizationLoginNork.put<any,any>(`/date/getCacheUpdate`,parms)
}